﻿@model Epi.Web.MVC.Models.OrgAdminInfoModel
@{
    ViewBag.Title = "Epi Info™ Cloud Data Capture - Site Administration";// + " - "+ 
    // Model.SurveyName + " - " + Model.IsDraftModeStyleClass;
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<style>
    .pageheader {font: 24px Segoe UI; color:#286655;}
    .h2header {font: 18px Segoe UI; color:#286655; font-weight:400; margin: 15px 0 0 0 !important;}
    .accountdiv {float:right; width:400px; background:#EBEFF5; border:1px solid #bfbfbf; border-radius:15px; padding:10px 10px 10px 20px;}
    .introdiv {float:left; width:355px; padding:0 10px 0 0;}
    .accountlabel {font: 14px Segoe UI; font-weight:600;}
    .termsofuse {width:790px; padding:5px; height: 300px; border:2px solid #bfbfbf; overflow:auto;}
    .submits {
     border: 1px #4e9689 solid;
     -moz-border-radius: 10px;
     -webkit-border-radius: 10px;
     -khtml-border-radius: 10px;
     border-radius: 10px;
     padding: 3px 5px 3px 5px;
     color:#3f3f3f;
     font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
     font-size: 10pt;
     font-weight:bold;
     padding-left:10px;
     height: 35px;
     width:100px;
     cursor:pointer;
     border: 1px solid rgba(0,0,0,0.5);
     box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
     -o-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
     -webkit-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
     -moz-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
     }
     .submits:hover { background: #ffc;}
     .create {background: #5880b3; background: rgba(88,128,179,0.6); max-width: 160px; width:100%;}
     [disabled] { color:#737882; background-color:#dfdfce;
         box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3); 
         -o-box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
     -webkit-box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
     -moz-box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);         
     }
     [disabled]:hover {background-color:#dfdfce;}
     .Account
     {
        width:350px;
        height:24px;
        font: 14px Segoe UI; 
      }
    .field-validation-error {
    color: #ff0000;
}

.field-validation-valid {
    display: none;
}

.input-validation-error {
    border: 1px solid #ff0000;
    background-color: #ffeeee;
}

.validation-summary-errors {
    font-weight: bold;
    color: #ff0000;
}

.validation-summary-valid {
    display: none;
}
input[type="checkbox"] {
    display: inline-block;
    width: 0;
}
</style>
 
<link  href="@Url.Content("~/Content/css/eweAdmin.css")" rel="Stylesheet" type="text/css" />
   <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
@*<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" language="javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>  *@
<script type="text/javascript" language="javascript">
    //    $(document).ready(function () {

    //        $('#persons').keyup(function () {

//            var UpdateUrl = '@Url.Action("AutoComplete", "AdminOrganization")'+"?term=" + $('#persons').val()  ;

    //            $.ajax({
    //                url: UpdateUrl,
    //                type: 'POST',
    //                contentType: 'application/json; charset=utf-8',
    //                //data: "{}",
    //                dataType: "json",
    //                //cache: false,
    //                async: false,
    //                success: successFunc,
    //                error: errorFunc
    //            });
    //            $.ajaxSetup({ cache: false });
    //            function successFunc(data) {
    //
    //                var availableTags = data;
    //                $('#persons').autocomplete({ source: availableTags });
    //            }
    //            function errorFunc(data) {
    //                alert('failed');
    //            }



    //
    //        });
    //    });
    $(document).ready(function () {
        $("div#demoheader").css({ "margin": "-2px 0px 0px 10px" });
       
            if ('@Session["IsDemoMode"]' == "TRUE") 
            {
                //  disableElements($('#content').children());
                $('[name="input"]').attr("disabled", true);
                $('[name="input"]').attr("title", "This feature is not available in demo mode");
            }

        $("#ConfirmAdminEmail").change(function () {

            var _ConfirmAdminEmail = $("#ConfirmAdminEmail").val();
            var _AdminEmail = $("#persons").val();

            if (_ConfirmAdminEmail == _AdminEmail) {


                    var signoutUrl = '@Url.Action("GetUserInfoAD", "AdminOrganization")' + '?email=' + _ConfirmAdminEmail;

                $.ajax({
                    url: signoutUrl,
                    type: 'POST',
                    contentType: 'application/json; charset=utf-8',
                    dataType: "json",
                    async: false,
                    success: successFunc,
                    error: errorFunc
                });


                function successFunc(data) {
                    $("#AdminFirstName").val(data.FirstName);
                    $("#AdminLastName").val(data.LastName);

                }
                function errorFunc() {
                    alert('error');
                }

            }
        });

    });
    function disableElements(el) {
        for (var i = 0; i < el.length; i++) {
            el[i].disabled = true;

            disableElements(el[i].children);
        }
    }
    function Cancel() {

        var signoutUrl = '@Url.Action("OrgList", "AdminOrganization")';
       
        window.location.href = signoutUrl ;
    }

</script>
<div id="pageHeader">
	<div id="pageTitleAdmin">
		@*<h2 class="adminnav ">@Html.ActionLink("Organizations", "Index", "Admin", null, null)</h2>&nbsp;&nbsp;
		<h2 class="adminnav admincurrent">Users</h2>*@
	</div>
 
	
	<div id="userwelcome">
		Welcome <strong>@Session["UserFirstName"] @Session["UserLastName"]</strong>@if (@System.Configuration.ConfigurationManager.AppSettings["WINDOW_AUTHENTICATION"].ToUpper() == "NO")
        {
            <span>&nbsp; | &nbsp;</span>
        }
	  @*  <a href="#">Log Out</a>*@
	  
	  @Html.ActionLink("Home", "Index", "Home", null, null) &nbsp; | &nbsp;
@if (@System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"] != null)
{
    if (@System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"].ToUpper() == "TRUE")
    {
        <a href="http://www.cdc.gov/epiinfo/cloud/index.html">Log Out</a>

    }
    else
    {
        if (@System.Configuration.ConfigurationManager.AppSettings["WINDOW_AUTHENTICATION"].ToUpper() == "NO")
        { 
	         @Html.ActionLink("Log Out", "LogOut", "Home", null, null)	
        }
    }
}
	</div>
	<div style="clear: both;"></div>
</div>

<div id="content" style="margin:15px 0 200px; padding-left: 10px; min-height: 375px;">

	<div id="formtitle" style="display:block;">
    @if(Model.IsEditMode){
		<h2 class="surveyTitle">Edit Organizations</h2>
        }else{
        <h2 class="surveyTitle">Add Organizations</h2>
        }
	</div>
	<div style="clear:both;"></div>

	<div class="datagrid">

 @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "myform", @class = "" }))
     {
	@*@Html.ValidationSummary(true, "Please correct the errors and try again.")*@

	<fieldset style="width:800px">
		<legend>UserModels</legend>
		<ol class="leftlist">
			<li>
				<h3>Organization Details.</h3>
                  @Html.ValidationMessage("Error")<br>
			</li>
			<li>
          
				@*@Html.LabelFor(m => m.OrganizationModel.Organization)
				@Html.TextBoxFor(m => m.OrgName)*@
                 @*@Html.ValidationMessage("Error") *@
                <label class="accountlabel" id="OrganizationNamelabel" for="OrgName">* Organization Name:</label> 
                 @Html.TextBoxFor(m => m.OrgName, new { @class = "Account" }) <br>
                @Html.ValidationMessageFor(m => m.OrgName, null, new { @class = "required" })
                

			</li>
			<li>
           
                @Html.ValidationMessageFor(m => m.IsOrgEnabled, null, new { @class = "required" })
                @Html.CheckBoxFor(m => m.IsOrgEnabled, new { @checked = "checked" })
                <label for="IsOrgEnabled" class="accountlabel" id="Activelabel">

                    Organization is Enabled
                </label>
              
                
			</li>
			 
		</ol>
 

         @if (!Model.IsEditMode)
             {
		<ol class="rightlist">
			<li>
				<h3>Administrator Information.</h3>
			</li>
             <li>
                 <label class="accountlabel" id="AdminEmaillabel" for="persons">* Admin Email:</label> 
				  @Html.TextBoxFor(m => m.AdminEmail, new { @id = "persons", @class = "Account" }) <br>
                @Html.ValidationMessageFor(m => m.AdminEmail, null, new { @class = "required" })
			</li>
			 
			<li>
                <label class="accountlabel" id="ConfirmAdminEmaillabel" for="ConfirmAdminEmail">* Confirm Admin Email:</label> 
				  @Html.TextBoxFor(m => m.ConfirmAdminEmail, new { @class = "Account" }) <br>
                @Html.ValidationMessageFor(m => m.ConfirmAdminEmail, null, new { @class = "required" })
			<li></li>
			<li>
                <label class="accountlabel" id="AdminFirstNamelabel" for="AdminFirstName">* Admin First Name:</label> 
			  @Html.TextBoxFor(m => m.AdminFirstName, new { @class = "Account" }) <br>
                @Html.ValidationMessageFor(m => m.AdminFirstName, null, new { @class = "required" })
			</li>
			<li>
                <label class="accountlabel" id="AdminLastNamelabel" for="AdminLastName">* Admin Last Name:</label> 
				  @Html.TextBoxFor(m => m.AdminLastName, new { @class = "Account" }) <br>
                @Html.ValidationMessageFor(m => m.AdminLastName, null, new { @class = "required" })
			</li>
			
		</ol>
             }
		<div>
        <div style="clear:both;"></div>
         @if (!Model.IsEditMode)
         {
            <input class="createbtn" type="submit" name="input" value="Create" id="Create" />
         }
         else
         {
            <input class="createbtn"  type="submit" name="input" value="Update" id="Update" />

         }
            <input class="createbtn" type="button" name="input" onclick="Cancel();" value="Cancel" />
         @*@Html.ActionLink("Cancel", "OrgList", "AdminOrganization", null, new { @class = "cancelbtn" })*@

          
        
		</div>
	</fieldset>
}

	
	
	  
	</div>
	<div style="clear:both; visibility:collapse;"></div>
</div>
